
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Npprogress from 'nprogress'
import 'nprogress/nprogress.css'
const routes :Array<RouteRecordRaw>= [
    {
        path: '/',
        name: 'home',
        component: () => import('@/views/home/index.vue') ,
        meta: {
            title: '首页'
        },
        children: []
    }
] ;

const router = createRouter({
    history: createWebHistory(),
    routes  
})

router.beforeEach(async (to, from, next) => {
    document.title = to.meta.title as string
    Npprogress.start()
    next()
})

router.afterEach(() => {
    Npprogress.done()
})

export default router